home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / SASC_6.0_Disk_4.adf / Compiler_Headers / Include / libraries / commodities.h < prev    next >
C/C++ Source or Header  |  1992-07-30  |  7KB  |  201 lines

  1. #ifndef LIBRARIES_COMMODITIES_H
  2. #define LIBRARIES_COMMODITIES_H
  3.  
  4. /*
  5. **   $Filename: libraries/commodities.h $
  6. **   $Release: 2.04 Includes, V37.4 $
  7. **   $Revision: 37.1 $
  8. **   $Date: 91/04/15 $
  9. **
  10. **   Commodities definitions.
  11. **
  12. **   (C) Copyright 1988-1991 Commodore-Amiga Inc.
  13. **    All Rights Reserved
  14. */
  15.  
  16. #ifndef EXEC_TYPES_H
  17. #include <exec/types.h>
  18. #endif
  19.  
  20. /*************************
  21.  * object creation macros
  22.  *************************/
  23. #define CxFilter(d)        CreateCxObj((LONG)CX_FILTER, (LONG) d, 0)
  24. #define CxTypeFilter(type)  CreateCxObj((LONG)CX_TYPEFILTER, (LONG) type, 0)
  25. #define CxSender(port,id)   CreateCxObj((LONG)CX_SEND, (LONG) port, (LONG) id)
  26. #define CxSignal(task,sig)  CreateCxObj((LONG)CX_SIGNAL,(LONG) task, (LONG) sig)
  27. #define CxTranslate(ie)     CreateCxObj((LONG)CX_TRANSLATE, (LONG) ie, 0)
  28. #define CxDebug(id)        CreateCxObj((LONG)CX_DEBUG, (LONG) id, 0)
  29. #define CxCustom(action,id) CreateCxObj((LONG)CX_CUSTOM,(LONG)action,(LONG)id)
  30.  
  31. /***************
  32.  * Broker stuff
  33.  ***************/
  34.  
  35. /* buffer sizes   */
  36. #define CBD_NAMELEN    24
  37. #define CBD_TITLELEN    40
  38. #define CBD_DESCRLEN    40
  39.  
  40. /* CxBroker errors   */
  41. #define CBERR_OK    0     /* No error                 */
  42. #define CBERR_SYSERR    1     /* System error , no memory, etc    */
  43. #define CBERR_DUP    2     /* uniqueness violation         */
  44. #define CBERR_VERSION    3     /* didn't understand nb_VERSION     */
  45.  
  46. #define NB_VERSION    5     /* Version of NewBroker structure   */
  47.  
  48. struct NewBroker {
  49.    BYTE     nb_Version;     /* set to NB_VERSION             */
  50.    BYTE     *nb_Name;
  51.    BYTE     *nb_Title;
  52.    BYTE     *nb_Descr;
  53.    SHORT    nb_Unique;
  54.    SHORT    nb_Flags;
  55.    BYTE     nb_Pri;
  56.    struct MsgPort   *nb_Port;
  57.    WORD     nb_ReservedChannel;  /* plans for later port sharing     */
  58. };
  59.  
  60. /* Flags for nb_Unique */
  61. #define NBU_DUPLICATE    0
  62. #define NBU_UNIQUE    1     /* will not allow duplicates         */
  63. #define NBU_NOTIFY    2     /* sends CXM_UNIQUE to existing broker */
  64.  
  65. /* Flags for nb_Flags */
  66. #define   COF_SHOW_HIDE 4
  67.  
  68. /********
  69.  * cxusr
  70.  ********/
  71.  
  72. /** Fake data types for system private objects     */
  73. #ifndef CX_H
  74. typedef LONG   CxObj;
  75. typedef LONG   CxMsg;
  76. #endif
  77.  
  78. /* Pointer to Function returning Long    */
  79. typedef LONG   (*PFL)();
  80.  
  81. /********************************/
  82. /** Commodities Object Types   **/
  83. /********************************/
  84. #define CX_INVALID    0     /* not a valid object (probably null)  */
  85. #define CX_FILTER    1     /* input event messages only         */
  86. #define CX_TYPEFILTER    2     /* filter on message type         */
  87. #define CX_SEND    3     /* sends a message             */
  88. #define CX_SIGNAL    4     /* sends a signal             */
  89. #define CX_TRANSLATE    5     /* translates IE into chain         */
  90. #define CX_BROKER    6     /* application representative         */
  91. #define CX_DEBUG    7     /* dumps kprintf to serial port         */
  92. #define CX_CUSTOM    8     /* application provids function         */
  93. #define CX_ZERO    9     /* system terminator node         */
  94.  
  95. /*****************/
  96. /** CxMsg types **/
  97. /*****************/
  98. #define CXM_UNIQUE   (1 << 4) /* sent down broker by CxBroker()      */
  99. /* Obsolete: subsumed by CXM_COMMAND (below)   */
  100.  
  101. /* Messages of this type rattle around the Commodities input network.
  102.  * They will be sent to you by a Sender object, and passed to you
  103.  * as a synchronous function call by a Custom object.
  104.  *
  105.  * The message port or function entry point is stored in the object,
  106.  * and the ID field of the message will be set to what you arrange
  107.  * issuing object.
  108.  *
  109.  * The Data field will point to the input event triggering the
  110.  * message.
  111.  */
  112. #define CXM_IEVENT   (1 << 5)
  113.  
  114. /* These messages are sent to a port attached to your Broker.
  115.  * They are sent to you when the controller program wants your
  116.  * program to do something.  The ID field identifies the command.
  117.  *
  118.  * The Data field will be used later.
  119.  */
  120. #define CXM_COMMAND   (1 << 6)
  121.  
  122. /* ID values   */
  123. #define CXCMD_DISABLE    (15)  /* please disable yourself       */
  124. #define CXCMD_ENABLE    (17)  /* please enable yourself        */
  125. #define CXCMD_APPEAR    (19)  /* open your window, if you can  */
  126. #define CXCMD_DISAPPEAR (21)  /* go dormant               */
  127. #define CXCMD_KILL    (23)  /* go away for good           */
  128. #define CXCMD_UNIQUE    (25)  /* someone tried to create a broker
  129.                    * with your name.  Suggest you Appear.
  130.                    */
  131. #define CXCMD_LIST_CHG    (27)  /* Used by Exchange program. Someone */
  132.                   /* has changed the broker list       */
  133.  
  134. /* return values for BrokerCommand(): */
  135. #define CMDE_OK    (0)
  136. #define CMDE_NOBROKER    (-1)
  137. #define CMDE_NOPORT    (-2)
  138. #define CMDE_NOMEM    (-3)
  139.  
  140. /* IMPORTANT NOTE:
  141.  * Only CXM_IEVENT messages are passed through the input network.
  142.  *
  143.  * Other types of messages are sent to an optional port in your broker.
  144.  *
  145.  * This means that you must test the message type in your message handling,
  146.  * if input messages and command messages come to the same port.
  147.  *
  148.  * Older programs have no broker port, so processing loops which
  149.  * make assumptions about type won't encounter the new message types.
  150.  *
  151.  * The TypeFilter CxObject is hereby obsolete.
  152.  *
  153.  * It is less convenient for the application, but eliminates testing
  154.  * for type of input messages.
  155.  */
  156.  
  157. /**********************************************************/
  158. /** CxObj Error Flags (return values from CxObjError())  **/
  159. /**********************************************************/
  160. #define COERR_ISNULL       1  /* you called CxError(NULL)         */
  161. #define COERR_NULLATTACH   2  /* someone attached NULL to my list    */
  162. #define COERR_BADFILTER    4  /* a bad filter description was given  */
  163. #define COERR_BADTYPE       8  /* unmatched type-specific operation   */
  164.  
  165.  
  166. /*****
  167.  * ix
  168.  *****/
  169.  
  170. #define IX_VERSION   2
  171.  
  172. struct InputXpression {
  173.    UBYTE   ix_Version;       /* must be set to IX_VERSION  */
  174.    UBYTE   ix_Class;       /* class must match exactly     */
  175.  
  176.    UWORD   ix_Code;
  177.    UWORD   ix_CodeMask;    /* normally used for UPCODE     */
  178.  
  179.    UWORD   ix_Qualifier;
  180.    UWORD   ix_QualMask;
  181.    UWORD   ix_QualSame;    /* synonyms in qualifier     */
  182.    };
  183. typedef struct InputXpression IX;
  184.  
  185. /* QualSame identifiers */
  186. #define IXSYM_SHIFT  1       /* left- and right- shift are equivalent    */
  187. #define IXSYM_CAPS   2       /* either shift or caps lock are equivalent    */
  188. #define IXSYM_ALT    4       /* left- and right- alt are equivalent    */
  189.  
  190. /* corresponding QualSame masks */
  191. #define IXSYM_SHIFTMASK (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)
  192. #define IXSYM_CAPSMASK    (IXSYM_SHIFTMASK    | IEQUALIFIER_CAPSLOCK)
  193. #define IXSYM_ALTMASK    (IEQUALIFIER_LALT   | IEQUALIFIER_RALT)
  194.  
  195. #define IX_NORMALQUALS    0x7FFF;/* for QualMask field: avoid RELATIVEMOUSE */
  196.  
  197. /* matches nothing   */
  198. #define NULL_IX(I)   ((I)->ix_Class == IECLASS_NULL)
  199.  
  200. #endif
  201.